﻿using System.Collections.Generic;

namespace com.binance.client.model.enums
{
	/// <summary>
	/// The balance mode used for subscribing the balance notification.
	/// </summary>
	public sealed class BalanceMode
	{

	  /// <summary>
	  /// Subscribe available balance
	  /// </summary>
	  public static readonly BalanceMode AVAILABLE = new BalanceMode("AVAILABLE", InnerEnum.AVAILABLE, "0");

	  /// <summary>
	  /// Subscribe TOTAL balance, total balance is the sum of available and frozen
	  /// </summary>
	  public static readonly BalanceMode TOTAL = new BalanceMode("TOTAL", InnerEnum.TOTAL, "1");

	  private static readonly IList<BalanceMode> valueList = new List<BalanceMode>();

	  static BalanceMode()
	  {
		  valueList.Add(AVAILABLE);
		  valueList.Add(TOTAL);
	  }

	  public enum InnerEnum
	  {
		  AVAILABLE,
		  TOTAL
	  }

	  public readonly InnerEnum innerEnumValue;
	  private readonly string nameValue;
	  private readonly int ordinalValue;
	  private static int nextOrdinal = 0;

	  private readonly string code;

	  internal BalanceMode(string name, InnerEnum innerEnum, string code)
	  {
		this.code = code;

		  nameValue = name;
		  ordinalValue = nextOrdinal++;
		  innerEnumValue = innerEnum;
	  }

	  public string Code
	  {
		  get
		  {
			return code;
		  }
	  }

		public static IList<BalanceMode> values()
		{
			return valueList;
		}

		public int ordinal()
		{
			return ordinalValue;
		}

		public override string ToString()
		{
			return nameValue;
		}

		public static BalanceMode valueOf(string name)
		{
			foreach (BalanceMode enumInstance in BalanceMode.valueList)
			{
				if (enumInstance.nameValue == name)
				{
					return enumInstance;
				}
			}
			throw new System.ArgumentException(name);
		}
	}

}